//                              _ooOoo_
//                             o8888888o
//                             88" . "88
//                             (| -_- |)
//                              O\ = /O
//                           ____/`---'\____
//                        .   ' \\| |// `.
//                         / \\||| : |||// \
//                        / _||||| -:- |||||- \
//                         | | \\\ - /// | |
//                       | \_| ''\---/'' | |
//                        \ .-\__ `-` ___/-. /
//                    ___`. .' /--.--\ `. . __
//                  ."" '< `.___\_<|>_/___.' >'"".
//                 | | : `- \`.;`\ _ /`;.`/ - ` : | |
//                    \ \ `-. \_ __\ /__ _/ .-` / /
//           ======`-.____`-.___\_____/___.-`____.-'======
//                              `=---='
//                   高山仰止,景行行止.虽不能至,心向往之。
//           .............................................
package com.ouc.eddyAlgorithm.domain;

public class OUCAjaxResult {

  private final int code;
  private final Object data;
  private final String message;

  private OUCAjaxResult(int code, Object data, String message) {
    this.code = code;
    this.data = data;
    this.message = message;
  }

  public int getCode() {
    return code;
  }

  public Object getData() {
    return data;
  }

  public String getMessage() {
    return message;
  }

  public static OUCAjaxResult ok() {
    return ok(null);
  }

  public static OUCAjaxResult ok(Object obj) {
    return ok(obj, "");
  }

  public static OUCAjaxResult ok(Object obj, String message) {
    return ok(obj, message, 200);
  }

  public static OUCAjaxResult ok(Object obj, String message, int code) {
    return new OUCAjaxResult(code, obj, message);
  }

  public static OUCAjaxResult error() {
    return error(null);
  }

  public static OUCAjaxResult error(Object obj) {
    return error(obj, "");
  }

  public static OUCAjaxResult error(Object obj, String message) {
    return error(obj, message, 500);
  }

  public static OUCAjaxResult error(Object obj, String message, int code) {
    return new OUCAjaxResult(code, obj, message);
  }

}
